package com.zyx.javademo.enumdemo;

/**
 * @author Yaxi.Zhang
 * @since 2021/6/29 12:13
 * desc: 颜色枚举类案例
 */
public class ColorDemo {
    public static void main(String[] args) {
        colorSwitchDemo();
    }

    private static void colorSwitchDemo() {
        Color myVar = Color.BLUE;
        // 在 switch 中使用枚举类
        switch(myVar) {
            case RED:
                System.out.println("红色");
                break;
            case GREEN:
                System.out.println("绿色");
                break;
            case BLUE:
                System.out.println("蓝色");
                break;
            default:
                System.out.println("未识别的颜色");
                break;
        }
    }
}
